package com.emip.bean;

import java.io.Serializable;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

import org.codehaus.jackson.annotate.JsonIgnore;


@Entity
@Table(name = "T_QUATERSTORE")
public class QuarterStoreBean implements Store, Serializable {

	private static final long serialVersionUID = 1L;
	
	@Id
    @GeneratedValue(strategy = GenerationType.SEQUENCE,generator="S_QUATER_ID_GENE")
    @SequenceGenerator(name="S_QUATER_ID_GENE",sequenceName="S_QUATER_ID", allocationSize = 1)
	private int id;
	
	@ManyToOne(cascade = { CascadeType.PERSIST, CascadeType.MERGE })
    @JoinColumn(name = "siteID")
	private SiteBean site;
	@ManyToOne(cascade = { CascadeType.PERSIST, CascadeType.MERGE })
    @JoinColumn(name = "itemID")
	private ItemBean item;
	@Column(name="value")
	private String value ;
	@Column(name="flag")
	private String flag;
	@Column(name="readable")
	private String readable;	
	@Column(name="publishable")
	private String publishable;
	@Column(name="year")
	private String year;
	@Column(name="quater")
	private int quater;
	
	public QuarterStoreBean() {}

	public int getId() {
		return this.id;
	}

	public void setId(int id) {
		this.id = id;
	}

	@JsonIgnore
	public String getSiteID() {
		return site.getId();
	}

	public SiteBean getSite() {
		return site;
	}

	public void setSite(SiteBean site) {
		this.site = site;
	}

	@JsonIgnore
	public String getItemID() {
		return item.getId();
	}

	public ItemBean getItem() {
		return item;
	}

	public void setItem(ItemBean item) {
		this.item = item;
	}

	public String getValue() {
		return value;
	}

	public void setValue(String value) {
		this.value = value;
	}

	public String getFlag() {
		return flag;
	}

	public void setFlag(String flag) {
		this.flag = flag;
	}

	public String getReadable() {
		return readable;
	}

	public void setReadable(String readable) {
		this.readable = readable;
	}

	public String getPublishable() {
		return publishable;
	}

	public void setPublishable(String publishable) {
		this.publishable = publishable;
	}

	public String getYear() {
		return year;
	}

	public void setYear(String year) {
		this.year = year;
	}

	public int getQuater() {
		return quater;
	}

	public void setQuater(int quater) {
		this.quater = quater;
	}

	@JsonIgnore
	public String getTimeLabel() {
		return this.year + "年" + this.quater + "季";
	}
	
}
